<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont backIcon" alia="返回">&#xe624;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      <span>输入城市\景点\游玩主题</span>
    </div>
    <router-link to="/city">
      <div class="header-right">
        <span>{{this.city}}</span>
        <span class="iconfont arrowIcon">&#xe64a;</span>
      </div>
    </router-link>
  </div>
</template>

<script>
  import {mapState} from 'vuex'
  export default{
    name:'HomeHeader',
    //将vuex中的数据映射到计算属性的city中
    computed:{
      ...mapState(['city'])
    }
  }
</script>
<!--使用lang="stylus"说明使用stylus，使用scoped使类名只在当前组件中起作用-->
<style lang="stylus" scoped>
  @import "~styles/varibles.styl"
  .header
    display:flex
    line-height $headerHeight
    background-color :$bgColor
    color :#ffffff

  .header-left
    width:.64rem
    float:left
    .backIcon
      text-align center
      font-size .4rem

  .header-input
    flex:1
    margin-top .12rem
    height:.64rem
    line-height:.64rem
    margin-left:.2rem
    padding-left .2rem
    background-color:#ffffff
    border-radius:.1rem
    color: #cccccc
    //text-align:center

  .header-right
    color #fff
    min-width:1.04rem
    padding .1rem
    float:right
    text-align :center
    .arrowIcon
      font-size .2rem


</style>
